<div class="content-wrapper" [@routerTransition]>
    <sub-header  idName="Editions" [title]="'Editions' | localize"
                [description]="'EditionsHeaderInfo' | localize">
        <div role="actions">
            <button *ngIf="'Pages.Editions.Create' | permission" class="btn btn-primary"
                    (click)="createEdition()"><i class="fa fa-plus"></i>
                {{"CreateNewEdition" | localize}}</button>
        </div>
    </sub-header>
    <section class="content d-flex flex-column flex-column-fluid">
        <div [class]="containerClass">
            <div class="card card-custom gutter-b">
                <div class="card-body">
                    <div class="row align-items-center">
                        <!--<Primeng-TurboTable-Start>-->
                        <div class="col primeng-datatable-container" [busyIf]="primengTableHelper.isLoading">
                            <p-table #dataTable (onLazyLoad)="getEditions()" [value]="primengTableHelper.records"
                                     rows="{{primengTableHelper.defaultRecordsCountPerPage}}" [paginator]="false"
                                     [lazy]="true" [responsive]="primengTableHelper.isResponsive">
                                <ng-template pTemplate="header">
                                    <tr>
                                        <th style="width: 130px;"
                                            [hidden]="!(['Pages.Editions.Edit', 'Pages.Editions.Delete'] | permissionAny)">
                                            {{'Actions' | localize}}
                                        </th>
                                        <th>
                                            {{'EditionName' | localize}}
                                        </th>
                                    </tr>
                                </ng-template>
                                <ng-template pTemplate="body" let-record="$implicit">
                                    <tr>
                                        <td style="width: 130px;text-align:center">
                                            <div class="btn-group" dropdown placement="bottom left">
                                                <button id="dropdownButton" type="button" class="btn btn-primary btn-sm dropdown-toggle" dropdownToggle aria-controls="dropdownMenu">
                                                    <i class="fa fa-cog"></i><span class="caret"></span>
                                                    {{"Actions" | localize}}
                                                </button>
                                                <ul id="dropdownMenu" class="dropdown-menu" role="menu" *dropdownMenu aria-labelledby="dropdownButton">
                                                    <li *ngIf="'Pages.Editions.Edit' | permission" role="menuitem">
                                                        <a href="javascript:;" class="dropdown-item"                                                           
                                                           (click)="editEditionModal.show(record.id)">{{'Edit' | localize}}</a>
                                                    </li>

                                                    <li *ngIf="'Pages.Editions.Delete' | permission" role="menuitem">
                                                        <a href="javascript:;" class="dropdown-item"
                                                           (click)="deleteEdition(record)">{{'Delete' | localize}}</a>
                                                    </li>

                                                </ul>
                                            </div>
                                        </td>
                                        <td>
                                            <span class="p-column-title">{{'EditionName' | localize}}</span>
                                            {{record.displayName}}
                                        </td>
                                    </tr>
                                </ng-template>
                            </p-table>
                            <div class="primeng-no-data" *ngIf="primengTableHelper.totalRecordsCount == 0">
                                {{'NoData' | localize}}
                            </div>
                            <div class="ui-table-footer">
                            </div>
                        </div>
                        <!--<Primeng-TurboTable-End>-->
                    </div>
                </div>
            </div>
        </div>
    </section>

    <createEditionModal #createEditionModal (modalSave)="getEditions()"></createEditionModal>
    <editEditionModal #editEditionModal (modalSave)="getEditions()"></editEditionModal>
</div>
